modernTimeline.js ➔ modernTimelineLog   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 3
c 0
b 0
f 0
dl 0
loc 5
rs 10
1
( function ( mw ) {
2
3
    modernTimelineLog( 'Timeline script' );
4
5
    function modernTimelineLog( message ) {
6
        if( mw.config.get( 'debug' ) ) {
7
            console.log( message );
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
8
        }
9
    }
10
11
    mw.loader.using( [ 'ext.modern.timeline' ] ).done( function () {
12
        modernTimelineLog( 'Loaded timeline JS' );
13
14
        for( var timelineId in window.modernTimeline ) {
15
            if( window.modernTimeline.hasOwnProperty( timelineId ) ) {
16
                modernTimelineLog( 'Initializing timeline "' + timelineId + '"' );
17
18
                var timelineJson = window.modernTimeline[timelineId];
19
                new TL.Timeline( timelineId, timelineJson, timelineJson.options );
0 ignored issues
show
Bug introduced by
The variable TL seems to be never declared. If this is a global, consider adding a /** global: TL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Unused Code Best Practice introduced by
The object created with new TL.Timeline(timeline..., timelineJson.options) is not used but discarded. Consider invoking another function instead of a constructor if you are doing this purely for side effects.
Loading history...
20
21
                modernTimelineLog( 'Done initializing timeline "' + timelineId + '"' );
22
            }
23
        }
24
    } );
25
26
}( mediaWiki ) );
0 ignored issues
show
Bug introduced by
The variable mediaWiki seems to be never declared. If this is a global, consider adding a /** global: mediaWiki */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...